In this script features of different calss of the neuron are shown. The features are in the form of histogram, density or scalar values.
In [1]:
import numpy as np
import McNeuron
import matplotlib.pyplot as plt
%matplotlib inline
In [ ]:
#loc1 = "/Volumes/Arch/Projects/Computational Anatomy/neuron_nmo/poorthuis/CNG version/060110-LII-III.CNG.swc"
loc1 = "../Generative-Models-of-Neuron-Morphology/Data/Pyramidal/poorthuis/CNG version/060110-LV.CNG.swc"
loc2 = "../Generative-Models-of-Neuron-Morphology/Data/Interneuron/allen cell types/CNG version/Pvalb-IRES-Cre-Ai14-475465561.CNG.swc"
pyramidal = McNeuron.Neuron(file_format = 'swc', input_file=loc1)
inter = McNeuron.Neuron(file_format = 'swc', input_file=loc2)
a = pyramidal.subsample(20.)
McNeuron.visualize.plot_2D(a,show_radius=True)
print len(a.nodes_list)
a.show_features(15,17,30)
In [ ]:
btmorph3.visualize.plot_2D(inter,show_radius=False)
In [ ]:
len(inter.nodes_list)
In [ ]:
ax1 = McNeuron.visualize.plot_2D(pyramidal, show_radius=False)
ax2 = McNeuron.visualize.plot_2D(inter, show_radius=False)
In [ ]:
inter.show_features(15,17,30)
In [ ]:
pyramidal.show_features(15,17,50)
For given real number of $r$, we can calculate how many times a sphere with the radius $r$ with the center of the soma intersects with the neuron. Sholl diagram shows this number for differnt values of $r$. For the pyramidal neuron it usually has two bumps, which represents the basal and apical dendrites, versus interneuron which usually has one.
In [ ]:
f,(ax1, ax2) = plt.subplots(1, 2)
ax1.plot(pyramidal.sholl_r,pyramidal.sholl_n,'g')
ax2.plot(inter.sholl_r,inter.sholl_n,'m')
In [ ]:
inter.features
In [ ]:
f, (ax1, ax2) = plt.subplots(1, 2)
a = pyramidal.diameter1
b = pyramidal.distance_from_root
c = ax1.hist(a[b>20],bins = 30,color = 'g')
ax1.set_xlabel('diameter (um3)')
ax1.set_ylabel('density')
#ax1.set_title('Histogram of the size of compartments of neuron')
a = inter.diameter
b = inter.distance_from_root
c = ax2.hist(a[b>20],bins = 15,color = 'm')
ax2.set_xlabel('diameter (um3)')
#ax2.set_ylabel('density')
#ax2.set_title('Histogram of the size of compartments of neuron')
In [ ]:
a = inter.diameter
b = inter.distance_from_root
c = plt.hist(a[b>20],bins = 15,color = 'm')
plt.xlabel('diameter (um3)')
In [ ]:
f, (ax1, ax2) = plt.subplots(1, 2)
e = pyramidal.slope
x = ax1.hist(e[e!=0],bins=40,color = 'g')
ax1.set_xlabel('Value of Slope')
ax1.set_ylabel('density')
e = inter.slope
x = ax2.hist(e[e!=0],bins=40,color = 'm')
ax2.set_xlabel('Value of Slope')
#ax2.set_ylabel('density')
In [ ]:
f, (ax1, ax2) = plt.subplots(1, 2)
a = pyramidal.distance_from_root
b = ax1.hist(a[~np.isnan(a)],bins = 50,color = 'g')
ax1.set_xlabel('distance (um)')
ax1.set_ylabel('density')
#plt.title('Histogram of distance from soma for different compartments of neuron')
a = inter.distance_from_root
b = ax2.hist(a[~np.isnan(a)],bins = 50,color = 'm')
ax2.set_xlabel('distance (um)')
#ax2.set_ylabel('density')
#plt.title('Histogram of distance from soma for different compartments of neuron')
In [ ]:
a = inter.distance_from_root
b = plt.hist(a[~np.isnan(a)],bins = 50,color = 'm')
plt.xlabel('distance (um)')
In [ ]:
f, (ax1, ax2) = plt.subplots(1, 2)
a = pyramidal.local_angle
b = ax1.hist(a[~np.isnan(a)],bins = 50,color = 'g')
ax1.set_xlabel('angle (radian)')
ax1.set_ylabel('density')
#plt.title('Histogram of local angles')
a = inter.local_angle
b = ax2.hist(a[~np.isnan(a)],bins = 50,color = 'm')
ax2.set_xlabel('angle (radian)')
#ax2.set_ylabel('density')
In [ ]:
a = inter.local_angle
b = plt.hist(a[~np.isnan(a)],bins = 50,color = 'm')
plt.xlabel('angle (radian)')
In [ ]:
f, (ax1, ax2) = plt.subplots(1, 2)
a = pyramidal.angle_global
b = ax1.hist(a[~np.isnan(a)],bins = 50,color = 'g')
ax1.set_xlabel('angle (radian)')
ax1.set_ylabel('density')
#plt.title('Histogram of global angles')
a = inter.angle_global
b = ax2.hist(a[~np.isnan(a)],bins = 50,color = 'm')
ax2.set_xlabel('angle (radian)')
In [ ]:
a = inter.angle_global
b = plt.hist(a[~np.isnan(a)],bins = 50,color = 'm')
plt.xlabel('angle (radian)')
In [ ]:
f, (ax1, ax2) = plt.subplots(1, 2)
a = pyramidal.angle_branch[0,:]
b = ax1.hist(a[~np.isnan(a)],bins = 20,color = 'g')
a = inter.angle_branch[0,:]
b = ax2.hist(a[~np.isnan(a)],bins = 20,color = 'm')
In [ ]:
a = inter.angle_branch[0,:]
b = plt.hist(a[~np.isnan(a)],bins = 10,color = 'm')
In [ ]:
f, (ax1, ax2) = plt.subplots(1, 2)
a = pyramidal.rall_ratio
b = ax1.hist(a[~np.isnan(a)],bins = 20,color = 'g')
a = inter.rall_ratio
b = ax2.hist(a[~np.isnan(a)],bins = 20,color = 'm')
In [ ]:
f, (ax1, ax2) = plt.subplots(1, 2)
a = pyramidal.slope
b = ax1.hist(a[~np.isnan(a)],bins = 40,color = 'g')
a = inter.slope
b = ax2.hist(a[~np.isnan(a)],bins = 40,color = 'm')
In [ ]:
a = inter.slope
b = plt.hist(a[~np.isnan(a)],bins = 40,color = 'm')
In [ ]:
f, (ax1, ax2) = plt.subplots(1, 2)
a = pyramidal.length_to_parent
b = ax1.hist(a[~np.isnan(a)],bins = 40,color = 'g')
a = inter.length_to_parent
b = ax2.hist(a[~np.isnan(a)],bins = 40,color = 'm')
In [ ]:
a = inter.length_to_parent
b = a[~np.isnan(a)]
c = plt.hist(b[np.absolute(b)<4],bins = 70,color = 'm')
In [ ]:
np.absolute(b)<3
In [ ]:
f, (ax1, ax2) = plt.subplots(1, 2)
ax1.hist(inter.overall_connectivity_matrix.sum(axis = 1)/inter.distance_from_root,bins = 40,color = 'g')
ax2.hist(pyramidal.overall_connectivity_matrix.sum(axis = 1)/pyramidal.distance_from_root,bins = 40,color = 'g')
In [ ]:
plt.hist(inter.features['ratio_euclidian_neuronal'],bins = 40,color = 'g')
In [ ]:
import matplotlib.pyplot as plt
%matplotlib inline
plt.imshow(inter.connection)
plt.show()
In [ ]: